package biz.ezcom.spring.ioc.test;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class Client {
	public static ClassPathXmlApplicationContext context = null;
	
	@BeforeClass
	public static void setUpBeforeClass() {
		context = new ClassPathXmlApplicationContext("applicationContext-bean.xml");
	}
	@AfterClass
	public static void tearDownAfterClass() {
		context.close();
	}
	
	@Test
	public void test(){
		System.out.println("==================start=======================");
		
		context.getBean("singleton");//ioc容器启动时init-method,关闭时destory-method
		context.getBean("singleton");
		
		context.getBean("prototype");//ioc容器new此对象时init-method,永远不会destory-method
		context.getBean("prototype");
		
		System.out.println("==================end=======================");
	}
	
}
